/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package football;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Herbert
 */
@Entity
@Table(name = "STADION")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Stadion.findAll", query = "SELECT s FROM Stadion s"),
    @NamedQuery(name = "Stadion.findByIdStadion", query = "SELECT s FROM Stadion s WHERE s.idStadion = :idStadion"),
    @NamedQuery(name = "Stadion.findByName", query = "SELECT s FROM Stadion s WHERE s.name = :name"),
    @NamedQuery(name = "Stadion.findByAdresse", query = "SELECT s FROM Stadion s WHERE s.adresse = :adresse")})
public class Stadion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_STADION")
    private Integer idStadion;
    @Size(max = 200)
    @Column(name = "NAME")
    private String name;
    @Size(max = 200)
    @Column(name = "ADRESSE")
    private String adresse;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idStadion")
    private Collection<Sektor> sektorCollection;

    public Stadion() {
    }

    public Stadion(Integer idStadion) {
        this.idStadion = idStadion;
    }

    public Integer getIdStadion() {
        return idStadion;
    }

    public void setIdStadion(Integer idStadion) {
        this.idStadion = idStadion;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    @XmlTransient
    public Collection<Sektor> getSektorCollection() {
        return sektorCollection;
    }

    public void setSektorCollection(Collection<Sektor> sektorCollection) {
        this.sektorCollection = sektorCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStadion != null ? idStadion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stadion)) {
            return false;
        }
        Stadion other = (Stadion) object;
        if ((this.idStadion == null && other.idStadion != null) || (this.idStadion != null && !this.idStadion.equals(other.idStadion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "football.Stadion[ idStadion=" + idStadion + " ]";
    }
    
}
